//
//  IOTCViewController.m
//  autolayout4
//
//  Created by User-13 on 3/26/14.
//  Copyright (c) 2014 IOTrainingCamp. All rights reserved.
//

#import "IOTCViewController.h"

@interface IOTCViewController ()
@property (weak, nonatomic) IBOutlet UIView *greenView;
@property (nonatomic) float angle;
@end

@implementation IOTCViewController
#define RADIUS 100
- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view, typically from a nib.
    NSTimer * timer = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(animateViews:) userInfo:Nil repeats:YES];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void) animateViews:(id) sender
{
    
    float x = [UIScreen mainScreen].bounds.size.width/2;
    x += RADIUS * cos(self.angle);
    float y = [UIScreen mainScreen].bounds.size.height/2;
    y += RADIUS * sin(self.angle);
    CGRect frame = CGRectMake(x - self.greenView.frame.size.width/2, y - self.greenView.frame.size.height/2, self.greenView.frame.size.width, self.greenView.frame.size.height);
    self.greenView.frame = frame;
    self.angle += 0.1;
}

@end
